package cn.com.sinosoft.money.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author wangyupeng
 * @despriction:
 * @ate:Created in 21:43 2019/1/26
 * @modify By:
 */
@Configuration
public class Swagger {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.com.sinsosft.money"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("反洗钱swagger构建api文档")
                .description("简单优雅的rest风格")
                .contact(new Contact("王玉鹏", "反洗钱", "wang_yupeng@sinosoft.com.cn"))
                .version("1.0")
                .description("API描述")
                .build();
    }
}
